package top.jsjkxyjs.blackbox.BigData;

import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.mapreduce.Partitioner;

public class RiskPredictionPartitioner extends Partitioner<IotData, NullWritable> {
	@Override
	public int getPartition(IotData iotData, NullWritable nullWritable, int i) {
		int partition = 5;
		if ("Fi".equals(iotData.getType())) {
			partition = 0;
		} else if ("gps_stat".equals(iotData.getType())) {
			partition = 1;
		} else if ("tem".equals(iotData.getType())) {
			partition = 2;
		} else if ("location".equals(iotData.getType())) {
			partition = 3;
		} else if ("hum".equals(iotData.getType())) {
			partition = 4;
		}
		return partition;
	}
}
